Skip to content

Fixes #5040. SelectorBase.TabBehavior setter calls CreateSubViews() without UpdateChecked(), desyncing CheckBox visual state#5044

Merged
tig merged 6 commits into
tui-cs:developfrom
BDisp:5040_selectorbase-updatechecked-fix
Apr 22, 2026
Merged

Fixes #5040. SelectorBase.TabBehavior setter calls CreateSubViews() without UpdateChecked(), desyncing CheckBox visual state#5044
tig merged 6 commits into
tui-cs:developfrom
BDisp:5040_selectorbase-updatechecked-fix

Conversation

@BDisp

@BDisp BDisp commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

Fixes

Proposed Changes/Todos

  • Call UpdateChecked inside the CreateSubViews method

Pull Request checklist:

  • I've named my PR in the form of "Fixes #issue. Terse description."
  • My code follows the style guidelines of Terminal.Gui - if you use Visual Studio, hit CTRL-K-D to automatically reformat your files before committing.
  • My code follows the Terminal.Gui library design guidelines
  • I ran dotnet test before commit
  • I have made corresponding changes to the API documentation (using /// style comments)
  • My changes generate no new warnings
  • I have checked my code and corrected any poor grammar or misspellings
  • I conducted basic QA to assure all features are working

…ws() without UpdateChecked(), desyncing CheckBox visual state

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the selector visual-state desync reported in #5040 by ensuring checkbox checked state is synchronized after selector subviews are recreated.

Changes:

  • Move “sync checked state” behavior to run after CreateSubViews () completes (instead of being manually invoked by several property setters).
  • Add logic in OptionSelector.UpdateChecked () to reset Value when it no longer matches any checkbox.
  • Add a new unit test covering Value reset when Values changes.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
Terminal.Gui/Views/Selectors/SelectorBase.cs Removes explicit UpdateChecked () calls from multiple setters and calls UpdateChecked () at the end of CreateSubViews ().
Terminal.Gui/Views/Selectors/OptionSelector.cs Extends UpdateChecked () to potentially reset Value if it’s not represented by any checkbox.
Tests/UnitTestsParallelizable/Views/SelectorBaseTests.cs Adds a test asserting Value resets when swapping Values to a set that doesn’t include the current value.

Comment thread Terminal.Gui/Views/Selectors/SelectorBase.cs
Comment thread Terminal.Gui/Views/Selectors/OptionSelector.cs
Comment thread Tests/UnitTestsParallelizable/Views/SelectorBaseTests.cs Outdated
@tig tig marked this pull request as draft April 21, 2026 21:16
@BDisp BDisp marked this pull request as ready for review April 22, 2026 00:11
@tig tig requested a review from Copilot April 22, 2026 01:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

Comment thread Terminal.Gui/Views/Selectors/OptionSelector.cs
Comment thread Terminal.Gui/Views/Selectors/OptionSelector.cs
Comment thread Tests/UnitTestsParallelizable/Views/SelectorBaseTests.cs Outdated

@rcdailey rcdailey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Thank you for fixing this!

@BDisp

BDisp commented Apr 22, 2026

Copy link
Copy Markdown
Collaborator Author

@tig, sometimes the solution takes an immense amount of time to build, constantly processing the GitVersion indefinitely. Often I have to abort the rebuild and try again, but it's really very painful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SelectorBase.TabBehavior setter calls CreateSubViews() without UpdateChecked(), desyncing CheckBox visual state

4 participants